#ifndef WIDGET_H
#define WIDGET_H

#include "common/baseeditor.h"
#include "addtable.h"
#include "addcolumn.h"

QT_BEGIN_NAMESPACE
namespace Ui { class Widget; }
QT_END_NAMESPACE

class Widget : public BaseEditor
{
    Q_OBJECT

public:
    Widget(QWidget *parent = nullptr);
    ~Widget();

    void generateMenu();
    void updateKeyMap();
    void updateView();
    void updateFilterView();
    void addItem();
    void addTable();
    void addColumn();

protected:
    void keyPressEvent(QKeyEvent *event);

private slots:
    void on_tableLabels_currentTextChanged(const QString &key);

    void on_btn_filter_clicked();

private:
    Ui::Widget *ui;

    QString colTable;
    QString selectTableName;
    QSqlQueryModel *model;
    QMap<QString,QString> keyMap;
    QMap<QString,int> idMap;
    int addFlag;
};
#endif // WIDGET_H
